package com.me.model.viewmodel;

import com.me.annotation.FieldAttr;
import com.me.model.User;
import com.me.enums.FieldType;

public class UserViewModel {
	@FieldAttr(value = "ID",type = FieldType.hidden)
	private String id;
	@FieldAttr(value = "用户名",required = true)
	private String username;
	@FieldAttr(value = "密码",type = FieldType.password,required = true)
	private String password;
	@FieldAttr(value = "新密码",type = FieldType.password,required = true)
	private String passwordNew;
	@FieldAttr("管理员")
	private boolean isAdmin;
	@FieldAttr("邮箱")
	private String email;
	@FieldAttr("收货人")
	private String name;
	@FieldAttr("收获电话")
	private String phone;
	@FieldAttr("收货地址")
	private String address;
	@FieldAttr("已验证邮箱")
	private boolean isValidate;

	public UserViewModel() {
	}

	public UserViewModel(User u) {
		this.id = u.getId();
		this.username = u.getUsername();
		this.isAdmin = u.isAdmin();
		this.email = u.getEmail();
		this.name = u.getName();
		this.phone = u.getPhone();
		this.address = u.getAddress();
		this.isValidate = u.isValidate();
	}

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getPasswordNew() {
		return passwordNew;
	}

	public void setPasswordNew(String passwordNew) {
		this.passwordNew = passwordNew;
	}

	public boolean isAdmin() {
		return isAdmin;
	}

	public boolean getIsAdmin() {
		return isAdmin;
	}

	public void setAdmin(boolean admin) {
		isAdmin = admin;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getPhone() {
		return phone;
	}

	public void setPhone(String phone) {
		this.phone = phone;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public boolean isValidate() {
		return isValidate;
	}

	public boolean getIsValidate() {
		return isValidate;
	}

	public void setValidate(boolean validate) {
		isValidate = validate;
	}
}
